@extends('layouts.app')
@include('user.sidebar')
@section('content')
    <div class="content">
        <a class="btn btn-info btn-sm" href="{{ redirect()->back()->getTargetUrl() }}"> 返回 </a>
        <br />
        <br />
        {!! form($form) !!}
    </div>
@endsection
@push("stylesheets")
    <style>
        .select2-container--default .select2-selection--multiple .select2-selection__choice {
            color: gray;
        }
    </style>
@endpush
@push('scripts')
    <script>
        // 按照客户要求, 修改表单样式
        // 表单通过后台生成, 所以通过js调整样式
        var _form_type = "{{isset($flag) ? $flag : ''}}";
        console.log(_form_type)
        if(_form_type == 'user'){
            $('.content').find('form').addClass('form-inline')
            $('.content').find('form').find('label').attr('style', 'width:100px;text-align:center')
            $('.form-group').attr('style', 'margin:10px 0px;');

            $('[for="mobile"]').parent().after('<br>');
            $('[for="name"]').parent().after('<br>');
        }else if(_form_type == 'staff'){
            $('.content').find('form').addClass('form-inline')
            $('.content').find('form').find('label').attr('style', 'width:160px;text-align:center;')
            $('.form-group').attr('style', 'margin:10px 0px;');

            $('[for="name"]').parent().after('<br>');
            $('[for="mobile"]').parent().after('<br>');
            $('[for="employee_identity"]').parent().after('<br>');
            $('[for="is_palm_management"]').parent().after('<br>');
            $('[for="shop_id[]"]').parent().after('<br>');
            $('[for="position"]').parent().after('<br>');
        }else if(_form_type == 'partner'){
            $('.content').find('form').addClass('form-inline')
            $('.content').find('form').find('label').attr('style', 'width:100px;text-align:center;')
            $('.form-group').attr('style', 'margin:10px 0px;');

            $('[for="name"]').parent().after('<br>');
            $('[for="id_number"]').parent().after('<br>');
            $('[for="job"]').parent().after('<br>');
            $('[for="address"]').parent().after('<br>');
            $('[for="company"]').parent().after('<br>');

            $('[for="image"]').next('div').attr('style', 'display:inline')
            $('[for="image"]').parent().find('br').remove();
            $('[for="image"]').parent().find('span').after('<br>');
            $('[for="image"]').parent().find('p').attr('style', 'margin-left:10px;display:inline');
            $('[for="image"]').parent().after('<br>');

            $('[for="id_card_positive"]').next('div').attr('style', 'display:inline')
            $('[for="id_card_positive"]').parent().find('br').remove();
            $('[for="id_card_positive"]').parent().find('span').after('<br>');
            $('[for="id_card_positive"]').parent().find('p').attr('style', 'margin-left:10px;display:inline');
            $('[for="id_card_positive"]').parent().after('<br>');

            $('[for="id_card_back"]').next('div').attr('style', 'display:inline')
            $('[for="id_card_back"]').parent().find('br').remove();
            $('[for="id_card_back"]').parent().find('span').after('<br>');
            $('[for="id_card_back"]').parent().find('p').attr('style', 'margin-left:10px;display:inline');
            $('[for="id_card_back"]').parent().after('<br>');
        }
    </script>
    <script>
        $('#shop_id.select2').select2({
            width: "500px",
        });
    </script>
@endpush
